<template>
	<view>
		<!-- 自定义状态栏 -->
		<StatusBar title="通讯录"></StatusBar>
		
		
		<uni-list>
			<uni-list-item title="新的朋友" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png"
				thumb-size="medium"></uni-list-item>
			<uni-list-item title="群聊" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png"
				thumb-size="medium"></uni-list-item>
			<uni-list-item title="标签" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png"
				thumb-size="medium"></uni-list-item>
			<uni-list-item title="公众号" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png"
				thumb-size="medium"></uni-list-item>
		</uni-list>
		<text style="font-size: 12px; margin-left: 8px;">星标朋友</text>
		<uni-list>
			<uni-list-item title="非1" thumb="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png"
				thumb-size="medium"></uni-list-item>
		</uni-list>
		<text style="font-size: 12px; margin-left: 8px;">好友列表</text>
		<uni-list>
			<uni-list-item v-for="friend in friends" :key="friend.id" :title="friend.note ? friend.note : friend.nickname" :thumb="friend.faceImg"
				thumb-size="medium"></uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import StatusBar from '../../../component/common/StatusBar.vue'
	export default {
		data() {
			return {
				friends: []
			}
		},
		components: {StatusBar},
		methods: {
			getFriends() {
				let userInfo = JSON.parse(uni.getStorageSync('login-user-info'));
				this.$http('/user/friend/list', 'get', {
					userId: userInfo.id
				}).then(
					success => {
						if (success.code === 200) {
							this.friends = success.data
						}
					}
				)
			},
		},
		onShow() {
			this.getFriends()
		}
	}
</script>

<style lang="scss" scoped>

</style>